package com.lxh.lxhcrm.model.pojos;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;

/**
 * 维修接件详情表
 */
@Entity
@Table(name = "ser_detail", schema = "lxh_crm", catalog = "")
public class SerDetail {
    private int serDetailId;
    private String proDetailNumber;
    private Date productDate;
    private Date saleDate;
    private String stateBao;
    private String desFault;
    private String pointTalk;
    private String weiSchedule;

 //   private Integer workordId;
    private Workord workord;
//    private Integer productId;
    private Product product;
  //  private Integer departmentId;
    private Department department;

    @ManyToOne
    @JoinColumn(name = "workord_id")
    public Workord getWorkord() {
        return workord;
    }

    public void setWorkord(Workord workord) {
        this.workord = workord;
    }

    @ManyToOne
    @JoinColumn(name = "pro_detail_id")
    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    @ManyToOne
    @JoinColumn(name = "department_id")
    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }

    @Id
    @Column(name = "ser_detail_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public int getSerDetailId() {
        return serDetailId;
    }

    public void setSerDetailId(int serDetailId) {
        this.serDetailId = serDetailId;
    }

    @Basic
    @Column(name = "pro_detail_number", nullable = true, length = 255)
    public String getProDetailNumber() {
        return proDetailNumber;
    }

    public void setProDetailNumber(String proDetailNumber) {
        this.proDetailNumber = proDetailNumber;
    }

    @Basic
    @Column(name = "product_date", nullable = true)
    public Date getProductDate() {
        return productDate;
    }

    public void setProductDate(Date productDate) {
        this.productDate = productDate;
    }

    @Basic
    @Column(name = "sale_date", nullable = true)
    public Date getSaleDate() {
        return saleDate;
    }

    public void setSaleDate(Date saleDate) {
        this.saleDate = saleDate;
    }

    @Basic
    @Column(name = "state_bao", nullable = true, length = 200)
    public String getStateBao() {
        return stateBao;
    }

    public void setStateBao(String stateBao) {
        this.stateBao = stateBao;
    }

    @Basic
    @Column(name = "des_fault", nullable = true, length = 200)
    public String getDesFault() {
        return desFault;
    }

    public void setDesFault(String desFault) {
        this.desFault = desFault;
    }

    @Basic
    @Column(name = "point_talk", nullable = true, length = 200)
    public String getPointTalk() {
        return pointTalk;
    }

    public void setPointTalk(String pointTalk) {
        this.pointTalk = pointTalk;
    }

    @Basic
    @Column(name = "wei_schedule", nullable = true, length = 200)
    public String getWeiSchedule() {
        return weiSchedule;
    }

    public void setWeiSchedule(String weiSchedule) {
        this.weiSchedule = weiSchedule;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SerDetail serDetail = (SerDetail) o;
        return serDetailId == serDetail.serDetailId &&
                proDetailNumber.equals(serDetail.proDetailNumber) &&
                productDate.equals(serDetail.productDate) &&
                saleDate.equals(serDetail.saleDate) &&
                stateBao.equals(serDetail.stateBao) &&
                desFault.equals(serDetail.desFault) &&
                pointTalk.equals(serDetail.pointTalk) &&
                weiSchedule.equals(serDetail.weiSchedule);
    }

    @Override
    public int hashCode() {
        return Objects.hash(serDetailId, proDetailNumber, productDate, saleDate, stateBao, desFault, pointTalk, weiSchedule);
    }
}
